<?php

namespace App\Http\Controllers\rbac;

use App\Http\Controllers\Controller;
use App\Http\Controllers\login\BaseController;
use Illuminate\Http\Request;
use Illuminate\Pagination\Paginator;
use App\Models\Node;
class NodeController extends BaseController
{


    /**
     * 节点页面
     */
    public function nodePage(Request $request){


        Paginator::useBootstrap();
        $data = (new Node())->getNodeAll();
        return view('rbac/node_list',compact('data'));
    }

    /**
     * 节点添加页面
     */
    public function nodeCreate(){
        $data = (new Node())->getNodeAll();
        return view('rbac/node_create',compact('data'));

    }

    //    节点添加
    public function doNode(Request $request){
        $params = $request->except(['_token']);
        $res =  Node::create($params);
        if ($res){
            return $this->writeJson(0,'','添加成功');
        }else{
            return $this->writeJson(10001,'','添加失败');
        }

    }





}
